package com.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/hello")
// SpringMVC对servlet的封装  即 controller
public class Hello extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name="手撕Spring实现电商详情页面";
        System.out.println(name);
        // 将参数传递过去
        req.setAttribute("name",name);
        // 转发到指定页面
        req.getRequestDispatcher("WEB-INF/hello.jsp").forward(req,resp);
    }
}
